<!--
 * @description  : 市管-市场净化率评估列表
 * @descriptionDetail: 市管-市场净化率评估列表
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-08-08 14:43:02
-->
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar :is-white="false" :title="navTitle" :custom-back="goBack" style="z-index: 99999">
    </theme-navbar>
    <!-- #endif -->
    <view class="nolicence-search-lay" :style="{'top': isHideNav ? 0 : '44px'}">
      <u-search
        class="nolicence-search"
        shape="round"
        :clearabled="true"
        :showAction="true"
        actionText="确定"
        :animation="true"
        placeholder="请输入计划名称"
        v-model="searchKey"
        @custom="toSearchList"
      ></u-search>
    </view>
    <view class="content u-page">
      <me-table :i="0" :index="0" :top="102" :load-data="loadData" :height="getListViewHeight()" :init-load="false" ref="mescrollItem0">
        <view slot-scope="d" class="list-lay">
          <list-item-mpr-evaluation-plan :itemInfo="d.data" v-if="d.data.status != 0"></list-item-mpr-evaluation-plan>
        </view>
      </me-table>
    </view>
  </view>
</template>

<script>
import MescrollMoreMixin from "@/components/mescroll-uni/mixins/mescroll-more.js";
import meTable from "@/components/me-table.vue";
import ListItemMprEvaluationPlan from "./components/listItemMprEvaluationPlan.vue";
import checkCheckService from "@/service/check/check.service";
export default {
  components: {
    meTable,
    ListItemMprEvaluationPlan,
  },
  mixins: [MescrollMoreMixin,],
  data() {
    return {
      searchKey: "",
      user: this.$storage.get(this.$rp.common.USER),
    };
  },
  onLoad() {},
  mounted() {},
  methods: {
    getListViewHeight() {
      let p = this.$u.sys().windowHeight - 44 - 56 - uni.upx2px(10) - this.$u.sys().statusBarHeight;
      // #ifdef H5-DINGDING || H5-WECHAT
      p = this.$u.sys().windowHeight - uni.upx2px(10) - 56 - this.$u.sys().statusBarHeight;
      // #endif
      return p + "px";
    },
    toSearchList(e) {
      this.getMescroll(0).triggerDownScroll();
    },
    // 用的工作待办接口筛选数据，不用做分页查询，默认多查一批数据出来
    loadData(page) {
      let param = {
        page: page.num,
        limit: page.size,
        isFilterDraft: 1,
        // orgUuid: this.user.user.org.orgUuid,
        planName: this.searchKey,
        personUuid:this.user.user.personUuid,
      };
      this.$modal.showLoading("加载中...");
      return new Promise((resolve) => {
        checkCheckService
          .samplingPlanList(param)
          .then((res) => {
            this.$modal.hideLoading();
            if (res.success) {
              resolve({
                count: res.count,
                data: [...res.data,],
              });
            } else {
              resolve({
                count: 0,
                data: [],
              });
            }
          })
          .catch((err) => {
            this.$modal.hideLoading();
            resolve({
              count: 0,
              data: [],
            });
          });
      });
    },
    updateBackState(param) {},
  },
};
</script>

<style scoped lang="scss">
.page {
  padding: 0;
}
.content {
  background-color: #f3f4f5;
  min-height: 100%;
}
.nolicence-search-lay {
  background-color: #fff;
  position: fixed;
  // #ifndef H5-DINGDING
  top: 44px;
  // #endif
  // #ifdef H5-DINGDING
  top: 0px;
  // #endif
  z-index: 999;
  width: 100%;
  overflow: hidden;
}

.nolicence-search {
  padding: 10px;
  // padding: $cm-search-padding-row $cm-search-padding-column;
}
.list-lay {
  margin: 10px;
  // margin: $cm-conent-padding-column $cm-content-paddng-row;
}

</style>
